package com.suifeng.card.service.impl;

import com.suifeng.card.entity.Assets;
import com.suifeng.card.dao.AssetsDao;
import com.suifeng.card.service.AssetsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (Assets)表服务实现类
 *
 */
@Service("assetsService")
public class AssetsServiceImpl implements AssetsService {
    @Resource
    private AssetsDao assetsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Assets queryById(String id) {
        return this.assetsDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param assets 实例对象
     * @return 实例对象
     */
    @Override
    public Assets insert(Assets assets) {
        this.assetsDao.insert(assets);
        return assets;
    }

    /**
     * 修改数据
     *
     * @param assets 实例对象
     * @return 实例对象
     */
    @Override
    public Assets update(Assets assets) {
        this.assetsDao.update(assets);
        return this.queryById(assets.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.assetsDao.deleteById(id) > 0;
    }
}
